import QtQuick 2.6
import Sailfish.Silica 1.0
import "../config"
import "../component"

Page {
    id: appInfoPage
    //设置屏幕方向
    allowedOrientations: defaultAllowedOrientations
    property int pageHorizontalPadding: 40

    //页面位置标题
    UIPageLocation {
        id: pageLocation
        locationTag: qsTr("关于")
    }


    Column {
        id: contentContainer
        anchors{
            left: parent.left
            right: parent.right
            top: pageLocation.bottom
            bottom: parent.bottom
        }

        anchors.leftMargin: pageHorizontalPadding
        anchors.rightMargin: pageHorizontalPadding

        //顶部区域：图标 名字 版本
        Column {
            id:topColumn
            width: parent.width
            height: implicitHeight
            topPadding: Screen.height/10

            UIRadiusImage{
                radius: width*0.1
                width: Math.min(Screen.height,Screen.width)/4
                height: Math.min(Screen.height,Screen.width)/4
                source: "../img/icon_logo.png"
                anchors.horizontalCenter: parent.horizontalCenter
            }

            Row{
                height: children.implicitHeight
                anchors.horizontalCenter: parent.horizontalCenter

                Text {
                    id:appName
                    text: qsTr("SailBook ")
                    font.pixelSize: Theme.fontSizeLarge
                    anchors.verticalCenter: parent.verticalCenter
                    color: AppColor.themeMode.primaryColor
                }
                Text {
                    text: qsTr("for Sailfish OS")
                    font.pixelSize: Theme.fontSizeTiny
                    color: AppColor.themeMode.thirdColor
                    anchors.baseline: appName.baseline
                }
            }

            Label {
                text:  qsTr("0.0.9")
                color: AppColor.themeMode.thirdColor
                anchors.horizontalCenter: parent.horizontalCenter
            }

        }

        //版本日志
        ListModel {
            id: logModel

            ListElement {
                version: "0.0.9"
                dataTime: "2025-04-21"
                content: "应用创建"
            }
        }

        //中间日志区域
        SilicaListView {
            id: listView
            width: parent.width
            height: parent.height - topColumn.height - bottomColumn.height
            model: logModel
            header: SectionHeader {
                text: qsTr("更新日志")
                color: AppColor.themeMode.themeColor
            }

            delegate: Item {
                width: parent.width
                height: childrenRect.height

                Label {
                    id: version
                    text: model.version
                    font.pixelSize: Theme.fontSizeExtraSmall
                    color: AppColor.themeMode.secondaryColor
                    anchors {
                        left: parent.left
                        right: date.left
                        rightMargin: Theme.paddingSmall
                    }
                }

                Label {
                    id: date
                    text: model.dataTime
                    font.pixelSize: Theme.fontSizeExtraSmall
                    horizontalAlignment: Text.AlignRight
                    color: AppColor.themeMode.secondaryColor
                    anchors {
                        right: parent.right
                        baseline: version.baseline
                    }
                }


                Label {
                    id: content
                    text: model.content
                    font.pixelSize: Theme.fontSizeExtraSmall
                    color: AppColor.themeMode.primaryColor
                    anchors {
                        top: version.bottom
                        left: parent.left
                        right: parent.right
                    }
                }

            }

            VerticalScrollDecorator {}
        }

        //底部信息
        Column {
            id: bottomColumn
            width: parent.width
            height: implicitHeight
            bottomPadding: 60

            Label {
                text:  qsTr("Made By Yanbetion From 2025.04.21")
                color: AppColor.themeMode.thirdColor
                font.pixelSize: Theme.fontSizeTiny
                anchors.horizontalCenter: parent.horizontalCenter
            }

            LinkedLabel {
                plainText:  qsTr(" Project Source https://gitee.com/yun_gitee/sail-book")
                linkColor: AppColor.themeMode.thirdColor
                font.pixelSize: Theme.fontSizeTiny
                color: AppColor.themeMode.thirdColor
                anchors.horizontalCenter: parent.horizontalCenter
            }

            LinkedLabel {
                plainText:  qsTr("1137208994@qq.com")
                linkColor: AppColor.themeMode.thirdColor
                font.pixelSize: Theme.fontSizeTiny
                color: AppColor.themeMode.thirdColor
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }

    }
}
